package com.handpay.zztong.hp.klf;

import android.content.Context;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;

public class RelativeFixBackground extends RelativeLayout{

	public RelativeFixBackground(Context context, AttributeSet attrs) {
		super(context, attrs);
		fixBackgroundRepeat(this);
	}
	
	
	public  void fixBackgroundRepeat(View view)
	{
		Drawable bg = view.getBackground();
		if (bg != null)
		{
			if (bg instanceof BitmapDrawable)
			{
				BitmapDrawable bmp = (BitmapDrawable) bg;
				bmp.mutate(); // make sure that we aren't sharing state anymore
				bmp.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);
			}
		}
	}

}
